<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>教师风采添加</title>
<link rel="stylesheet" href="/scriptZIP/layui.min.css">
	<link rel="stylesheet" href="../css/item.css">
	<link rel="stylesheet" href="../css/layui.css" />
	<style>
		#portrait {
			width: 100px;
			height: 100px;
			border: 1px solid #ddd;
		}

		.layui-row {
			margin-top: 50px;
		}

		.layui-textarea {
			min-height: 200px !important;
		}
	</style>
</head>

<body>
	<div class="layui-row" id="vue-root">
		<div class="layui-col-md6 layui-col-md-offset3">
			<div class="layui-form-item">
				<label class="layui-form-label">姓名</label>
				<div class="layui-input-block">
					<input name="teacherMienName" v-validate="'required'" data-vv-as="姓名" autocomplete="off"
						placeholder="请输入老师姓名" class="layui-input name" v-model="item.name">
					<div class="checkout_state" v-text="err('teacherMienName')"></div>
				</div>

			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">职称</label>
				<div class="layui-input-block">
					<input name="teacherMienLevel" v-validate="'required'" data-vv-as="职称" autocomplete="off"
						placeholder="请输入教师职称" class="layui-input time" v-model="item.level">
					<div class="checkout_state" v-text="err('teacherMienLevel')">
					</div>
				</div>

			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">照片上传</label>
				<label for="File1" id="tu1">
					<img id="portrait" :src="img">
				</label>
				<div class="checkout_state" v-text="err('file')"></div>
				<form id="form" method="post" ref="form" enctype="multipart/form-data" style="display: none">
					<input type="file" id="File1" name="file" accept="image/*" @change="upload">
				</form>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">教师简介</label>
				<div class="layui-input-block">
					<textarea name="teacherMienIntro" v-validate="'required'" data-vv-as="教师简介" placeholder="请输入教师简介"
						class="layui-textarea introduction" v-model="item.intro"></textarea>
					<div class="checkout_state" v-text="err('teacherMienIntro')"></div>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">教学经验</label>
				<div class="layui-input-block">
					<textarea name="experience" v-validate="'required'" data-vv-as="教学经验" placeholder="请输入教学经验"
						class="layui-textarea text" v-model="item.experience"></textarea>
					<div class="checkout_state" v-text="err('experience')"></div>
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<div class="offer" @click="submit">立即提交</div>
					<div class="return" onclick="history.back()">取消</div>
				</div>
			</div>
		</div>
	</div>
	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>
	
	
	<script src="/scriptZIP/axios.min.js"></script>

	<script src="/js/common.js"></script>
	<script src="/js/item.js"></script>


	<script>
		var app = new Vue(merge({
			data: {
				item: {
					pic: null,
					schoolId: top_params().id
				},
				url: '/pc/teacherMien'
			},
			methods: {
				upload: function () {
					axios.post('/pc/upload/teacherMien?schoolId=' + this.item.schoolId, new FormData(this.$refs.form)).then(function (res) {
						this.item.pic = res.data.data;
					}.bind(this));
				}
			},
			computed: {
				img: function () {
					if (!this.item.pic) return '../image/upload.png';
					return '/static/' + this.item.schoolId + '/teacherMien/' + this.item.pic;
				}
			}
		}));
	</script>

</body>

</html>